//
//  WUMessTableViewCell.m
//  Home
//
//  Created by 吴军虎吴军虎 on 16/5/4.
//  Copyright © 2016年 LanJue. All rights reserved.
//

#import "WUMessTableViewCell.h"

@interface WUMessTableViewCell()


@property (nonatomic,retain)   UILabel *namelabel;
@property (nonatomic,retain)   UILabel *gonglabel;
@property (nonatomic,retain)   UILabel *timelabel;
@property (nonatomic,retain)   UILabel *wenlabel;

@end

@implementation WUMessTableViewCell


- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
}

-(instancetype) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self=[super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self creatSubViews];
    }
    return self;
}

-(void) creatSubViews
{
    UILabel *henglabel=[[UILabel alloc]init];
    henglabel.backgroundColor=[UIColor grayColor];
    henglabel.alpha=0.3;
    [self.contentView addSubview:henglabel];
    [henglabel mas_makeConstraints:^(MASConstraintMaker *make) {
       
        
        make.bottom.equalTo(self.contentView.mas_bottom).offset(-1 *AUTO_HEIGHT);
        make.left.equalTo(self.contentView).offset(135/2 *AUTO_WIDTH);
        make.right.equalTo(self.contentView.mas_right).offset(0);
        make.height.mas_equalTo(1 *AUTO_HEIGHT);
    }];
    
    
    //头像
    _touImage=[[UIImageView alloc]init];
    _touImage.image=[UIImage imageNamed:@"headBackImage"];
    _touImage.layer.masksToBounds=YES;
    _touImage.layer.cornerRadius=95/4 *AUTO_WIDTH;
    [self.contentView addSubview:_touImage];
    [_touImage mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.top.equalTo(self.contentView).offset(22/2 *AUTO_WIDTH);
        make.left.equalTo(self.contentView).offset(22/2 *AUTO_WIDTH);
        make.size.mas_equalTo(CGSizeMake(95/2 *AUTO_WIDTH, 95/2 *AUTO_WIDTH));
    }];
    
    
    //名字
    _namelabel=[[UILabel alloc]init];
    _namelabel.text=@"张叶军";
    _namelabel.alpha=0.7;
    _namelabel.font=[UIFont systemFontOfSize:15];
    [self.contentView addSubview:_namelabel];
    [_namelabel mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.top.equalTo(self.contentView).offset(32/2 *AUTO_WIDTH);
        make.left.equalTo(_touImage.mas_right).offset(29/2 *AUTO_WIDTH);
        make.size.mas_equalTo(CGSizeMake(_namelabel.text.length *19 *AUTO_WIDTH,19 *AUTO_WIDTH));
    }];
    
    
    //时间
    _timelabel=[[UILabel alloc]init];
    _timelabel.text=@"13:44";
    _timelabel.alpha=0.3;
    _timelabel.textColor=[UIColor grayColor];
    _timelabel.font=[UIFont systemFontOfSize:12];
    [self.contentView addSubview:_timelabel];
    [_timelabel mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.top.equalTo(self.contentView).offset(32/2 *AUTO_WIDTH);
        make.right.equalTo(self.contentView.mas_right).offset(-12/2 *AUTO_WIDTH);
        make.size.mas_equalTo(CGSizeMake(_namelabel.text.length *15 *AUTO_WIDTH, 15 *AUTO_WIDTH));
    }];
    
    
    //文字
    _wenlabel=[[UILabel alloc]init];
    _wenlabel.text=@"我发了一条信息我发了一条信息我发了一条信息我发了一条信息";
    _wenlabel.textColor=[UIColor grayColor];
    _wenlabel.alpha=0.7;
    _wenlabel.font=[UIFont systemFontOfSize:12];
    _wenlabel.numberOfLines=1;
    _wenlabel.lineBreakMode=NSLineBreakByTruncatingTail;
    [self.contentView addSubview:_wenlabel];
    [_wenlabel mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.top.equalTo(_namelabel.mas_bottom).offset(15/2 *AUTO_WIDTH);
        make.left.equalTo(_touImage.mas_bottom).offset(29/2 *AUTO_WIDTH);
        make.size.mas_equalTo(CGSizeMake(self.contentView.frame.size.width -46 *AUTO_WIDTH, 17 *AUTO_WIDTH));
    }];
    
}

@end
